<?php
class UploadModel extends Model
{
	static public function upload($file, $save_path, $thump = true, $_thump = array())
	{
		import('ORG.Net.UploadFile');
        $upload = new UploadFile();
        $upload->maxSize            = 3292200;
        $upload->allowExts          = explode(',', 'jpg,gif,png,jpeg'); 
		$upload->savePath           = $save_path;
        $upload->thumb              = $thump;
        $upload->imageClassPath     = 'ORG.Util.Image';
        $upload->thumbPrefix        = $_thmp['prefix'];  //生产1张缩略图
        $upload->thumbMaxWidth      = $_thmp['width'];
        $upload->thumbMaxHeight     = $_thmp['height'];
        $upload->saveRule           = 'uniqid';
        $upload->thumbRemoveOrigin  = true;
		
        if (!$upload->upload()) {
            return $upload->getErrorMsg();
        } else {
            return $upload->getUploadFileInfo();
        }
	}

}